﻿using System.Collections.Generic;
using EndtoEndSilverlightDemo.Tests;

namespace EndToEndSilverlightDemo
{
    public partial class Page : IPageTestDriver
    {
        #region IPageTestDriver Members

        void IPageTestDriver.TypeSearchPrefix(string searchPrefix)
        {
            txtProductString.Text = searchPrefix;
        }

        void IPageTestDriver.ClickSearchButton()
        {
            Button_Click(btnOne, null);
        }

        int IPageTestDriver.DisplayedProductRows
        {
            get { return (new List<object>((IEnumerable<object>) dataGridResults.ItemsSource)).Count; }
        }

        void IPageTestDriver.ClearLocalStorage()
        {
            settings.Clear();
            settings.Save();
            dataGridResults.ItemsSource = null;
        }

        bool IPageTestDriver.WebserviceHasReturnedData()
        {
            return dataGridResults.ItemsSource != null;
        }

        #endregion
    }
}